import 'package:uuid/uuid.dart';

final _uuid = Uuid();

class Event {
  final String id;
  final String name; //方法名字
  final DateTime timestampMicros;
  final Map<String, dynamic>? params; //json参数字符串

  Event({required this.name, required this.timestampMicros, this.params, String? id})
    : id = id ?? _uuid.v1();

  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'timestamp_micros': timestampMicros.microsecondsSinceEpoch.toString(),
      'params': params,
    };
  }
}
